package com.ranjiaqi.homework;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * @ClassName Test1
 * @Description TODO
 * @Author hp
 * @Date 2021/6/23 18:11
 * @Version 1.0
 **/
public class Test1 {
    public static void main(String[] args) {
        List<String> stringList = new ArrayList<String>();
        stringList.add("岁月");
        stringList.add("匆匆");
        stringList.add("渐行");
        stringList.add("渐远");
        stringList.add("往事");
        stringList.add("随风");
        stringList.add("告别");
        stringList.add("离去");
        stringList.add("努力");
        stringList.add("前进");
        System.out.println(stringList);
        stringList.add(2,"冉佳奇");
        String str = stringList.get(5);
        System.out.println("str = " + str);
        System.out.println(stringList);
        stringList.remove(6);
        stringList.set(7, "不见");
        Iterator<String> iterator = stringList.iterator();
        while(iterator.hasNext()){
            String str1 = iterator.next();
            System.out.println("str1 = " + str1);
        }


        for (Iterator<String> iterator1 = stringList.iterator();iterator1.hasNext(); System.out.println("iterator1.next() = " + iterator1.next())){

        }
    }
}
